package com.znsd.stu.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.znsd.entitys.RoleInfo;
import com.znsd.entitys.Users;
import com.znsd.stu.dao.UserDao;
import com.znsd.stu.service.UserService;
@Service
public class UserServiceImpl implements UserService {
	@Autowired
	private UserDao userDao;

	@Override
	public Users checkUsername(String username, String password) {
		Users users=new Users();
		users.setUser_username(username);
		users.setUser_password(password);
		return userDao.checkUsername(users);
	}

	@Override
	public Users checkUserPhone(String phone) {
		return userDao.checkUserPhone(phone);
	}

	@Override
	public int addUser(Users user) {
		return	userDao.addUser(user);
	}

	@Override
	public Integer updateUser(Users user) {
		return userDao.updateUser(user);
	}

	@Override
	public List<Users> queryLimitUser(Integer pageIndex, Integer limit) {
		return userDao.queryLimitUser(pageIndex,limit);
	}

	@Override
	public Integer queryUserCount() {
		return userDao.queryUserCount();
	}

	@Override
	public Integer updateuserRole(Users user, Integer quanxian) {
		RoleInfo role=new RoleInfo();
		role.setR_id(quanxian);
		user.setRole(role);
		return userDao.updateuserRole(user);
	}

	/*
	 * @Override public Users checkUsername(String username) { return
	 * userDao.checkUsername(username); }
	 */
	
	
}
